package tech.xs.auth.service.impl;

import org.springframework.stereotype.Service;
import tech.xs.auth.dao.AuthSysUserDao;
import tech.xs.auth.domain.entity.AuthSysUser;
import tech.xs.auth.domain.enums.result.LoginResultEnum;
import tech.xs.auth.service.AuthSysUserService;
import tech.xs.common.framework.service.CrudServiceImpl;
import tech.xs.common.framework.util.Assert;
import tech.xs.common.sys.domain.enums.SysAccountStatusEnum;

@Service
public class AuthSysUserServiceImpl extends CrudServiceImpl<AuthSysUserDao, AuthSysUser> implements AuthSysUserService {
    @Override
    public void checkLoginUser(AuthSysUser user) {
        Assert.isNotNull(user, "用户不存在或密码错误", false);
        Assert.isFalse(SysAccountStatusEnum.DISABLE.equals(user.getAccountStatus()), "账户已禁用", false);
        Assert.isNotNull(user.getPassword(), LoginResultEnum.ACCOUNT_NOT_INIT);
    }
}
